<?php
/**
* Fichier de la classe mère des modèles
* 
* PHP version 5.1.6
*
* @package   Smartbok
* @author    Christophe Hebet <christophe.hebet@dgfip.finances.gouv.fr> 
* @copyright 2013 - DGFiP
*/

class smartbokModele extends SmartbokDB
{    
    public function __construct($params) {
        $user = $params['user'];
        $pwd = $params['pwd'];
        $options = null;
        if (isset($params['options']) === true) {
            $options = $params['options'];
        }
        switch ($params['type']) {
            case 'oci':
                $dsn = $params['type'].':dbname='.$params['serveur'].'/'.$params['instance'];
                if (isset($params['charset']) === true) {
                    $dsn .= ';'.$params['charset'];
                }
            break;
                
            case 'pgsql':
                $dsn = $params['type'].':host='.$params['serveur'].';dbname='.$params['instance'];
            break;
            
            case 'mysql':
                $dsn = $params['type'].':host='.$params['serveur'].';dbname='.$params['instance'];
            break;
                        
            default:
                $dsn = null;
            break;
        
        }
        parent::__construct($dsn, $user, $pwd, $options);
        $this->_sgbd = $params['type'];
    }
}